Aggregate rows

Purpose of this building block

The Aggregate rows building block allows you to sum up values in your table or to perform other calculations that require iterating through all the rows of your table.

Possible use cases

  • Sum up values of a given sheet and include them into status reports

Configuration

Reload

Click on the reload icon to scan the Google Form for modified, added or removed fields.

After adding the script to your flow, click on the keyboard icon in the input parameter section.

bbAggregateRows.png

If you are summing up data of a particular column in your table to calculate the total, you will end up with a new variable holding the calculated value.

Useful combinations

First of all you'll have to initialize the new variables that you want to create. Use the result prefix when initializing your variables. If you want to create two variables called subtotal and vat , you'll have to initialize them like this:

result.vat = 0; result.subtotal = 0;

You can use variables in your statements, that will be evaluated before the script gets executed. So in case you want to initialize the new variables with existing values you can type in something like this:

result.vat = ${oldvat}; result.subtotal = ${startvalue}

After initializing the new variables, you can use them in the expression that will be evaluated for each row in your data:

result.vat += row.amount * row.quantity * ${vatrate} / 100; result.subtotal += row.amount * row.quantity

Questions and Feedback

If you have any comments on this guide, feel free to add them right to the Google document that we are using to create this site.

If you are not yet member of the Ultradox community on Google+, please join now to get updates from our end or to provide feedback, bug reports or discuss with other users.

Last Updated:

Share on Google+Share on FacebookShare on TwitterShare on LinkedIn